package com.tater;

import com.tater.config.NettyConfig;
import com.tater.handler.ServerHandler;
import com.tater.server.NettyServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author Administrator
 */
@SpringBootApplication
public class ProviderApplication implements CommandLineRunner {

    public static void main(String[] args) {
            SpringApplication.run(ProviderApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        new NettyServer(serverHandler(), NettyConfig.NETTY_PORT).start();
    }

    @Bean
    public ServerHandler serverHandler() {
        return new ServerHandler();
    }
}
